package com.zgys.mes.client.dto;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageInfo;
import lombok.Data;

import java.io.Serializable;
import java.util.List;

/**
 * Created by Administrator on 2018/5/22/022.
 */

@Data
public class PageInfoDto<T> implements Serializable {
    private int pageNum;
    //每页的数量
    private int pageSize;
    //总行数
    private long total ;
    //总页数
    private int pages;

    @JsonIgnore
    private Page<T> page;

    private List data;

    public PageInfoDto(List<T> list) {
        if (list instanceof Page) {
            this.page = (Page)list;

            this.pageNum = page.getPageNum();
            this.pageSize = page.getPageSize();
            this.pages = page.getPages();
            this.total = page.getTotal();
        }
    }
}
//public class PageInfoDto<T> {
//
//    //当前页
//    private int page;
//    //每页的数量
//    private int size;
//    //当前页的数量
//    private int currentSize;
//    //总记录数
//    private long total;
//    //总页数
//    private int pages;
//    //结果集
//    private List<T> list;
//
//    public PageInfoDto(PageInfo pageInfo) {
//        this.page = pageInfo.getPageNum();
//        this.size = pageInfo.getPageSize();
//        this.total = pageInfo.getTotal();
//        this.list = pageInfo.getList();
//        this.pages = pageInfo.getPages();
//    }
//}
